package com.webchat.rmi.act;


import com.webchat.common.bean.APIPageResponseBean;
import com.webchat.common.bean.APIResponseBean;
import com.webchat.domain.vo.request.CommentSaveVO;
import com.webchat.domain.vo.response.CommentResponseVO;
import com.webchat.rmi.interceptor.RpcRequestInterceptor;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(name = "webchat-act-service",
        contextId = "commentClient",
        configuration = RpcRequestInterceptor.class)
public interface ICommentClient {

    /**
     * 保存评论
     * @param vo
     * @return
     */
    @PostMapping("/addComment")
    APIResponseBean<Long> saveComment(@RequestBody CommentSaveVO vo);

    /**
     * 删除评论
     * @return
     */
    @PostMapping("/act-service/comment/deleteComment/{id}")
    APIResponseBean deleteComment(@PathVariable Long id);

    @PostMapping("/act-service/comment/top/{commentId}")
    APIResponseBean<Long> topComment(@PathVariable Long commentId);

    @PostMapping("/act-service/comment/cancelTop/{commentId}")
    APIResponseBean<Long> cancelTopComment(@PathVariable Long commentId);

    /***
     * 查询资源评论列表
     * @param resourceId
     * @param resourceType
     * @param isHot
     * @param isNew
     * @param pageNo
     * @param pageSize
     * @return
     */
    @GetMapping("/act-service/comment/query")
    APIPageResponseBean<List<CommentResponseVO>> queryComments(@RequestParam(value = "resourceId", required = false) Long resourceId,
                                                               @RequestParam(value = "resourceType", required = false) String resourceType,
                                                               @RequestParam(value = "content", required = false) String content,
                                                               @RequestParam(value = "isHot", required = false, defaultValue = "false") Boolean isHot,
                                                               @RequestParam(value = "isNew", required = false, defaultValue = "false") Boolean isNew,
                                                               @RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNo,
                                                               @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize);


}
